<?php
function controller_yayasan($config) {
    $db = new db($config);
	//slider
    $uploaddir = $config['image_path'].'yayasan'.DIRECTORY_SEPARATOR;
	$limitedext = array("jpg","jpeg","png","bmp");
	$cfiles = 0;
	$gambar = array();
	$files = scandir($uploaddir.'slide'.DIRECTORY_SEPARATOR);
	for($i = 0; $i < count($files); $i++) {
		$file = $files[$i];
		$getExt = explode('.',$file);
		$file_ext = $getExt[count($getExt)-1];
		if (in_array($file_ext,$limitedext)) {
			$img = $config['image_url'].'yayasan/slide/'.$file;
			array_push($gambar, $img);
		}
	}
	$param['slide'] = $gambar;
	//deskripsi
	$result = $db->query( "SELECT * FROM `deskripsi` WHERE page = 'yayasan'" );
	$desc = str_replace("\n", "<br />", $result[0]['deskripsi']);
	$param['deskripsi'] = $desc;
	//kontak
	$result = $db->query( "SELECT * FROM `kontak` WHERE page = 'yayasan'" );
	$param['kontak'] = $result[0];
	//
	view_yayasan($config, $param);
}
